package com.fc.v2.service;

import java.text.SimpleDateFormat;
import java.util.*;

import com.fc.v2.mapper.auto.ExperprojectMapper;
import com.fc.v2.mapper.auto.TSysRoleUserMapper;
import com.fc.v2.mapper.auto.TsysUserMapper;
import com.fc.v2.model.Examine;
import com.fc.v2.model.ExpertSelect;
import com.fc.v2.model.ProjectType;
import com.fc.v2.model.auto.*;
import com.fc.v2.shiro.util.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import cn.hutool.core.util.StrUtil;
import com.fc.v2.common.base.BaseService;
import com.fc.v2.common.support.ConvertUtil;
import com.fc.v2.mapper.auto.ApplyProjectMapper;
import com.fc.v2.model.custom.Tablepar;
import com.fc.v2.util.SnowflakeIdWorker;
import com.fc.v2.util.StringUtils;

/**
 * 立项申请 ApplyProjectService
 * @Title: ApplyProjectService.java 
 * @Package com.fc.v2.service 
 * @author Archie_自动生成
 * @email ${email}
 * @date 2021-11-04 11:35:35  
 **/
@Service
public class ApplyProjectService implements BaseService<ApplyProject, ApplyProjectExample>{
	@Autowired
	private ApplyProjectMapper applyProjectMapper;

	@Autowired
	private TsysUserMapper tsysUserMapper;

	@Autowired
	private ExperprojectMapper experprojectMapper;

	@Autowired
	private SysUserService sysUserService;

	@Autowired
	private SysPositionService sysPositionService;

	@Autowired
	private ApplyProjectService applyProjectService;

	@Autowired
	private TSysRoleUserMapper tSysRoleUserMapper;
	
      	   	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	
	/**
	 * 分页查询
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	 public PageInfo<ApplyProject> list(Tablepar tablepar,ApplyProject applyProject){
	        ApplyProjectExample testExample=new ApplyProjectExample();
			ApplyProjectExample.Criteria criteria = null;
		    String userId = ShiroUtils.getUserId();
			//项目名称搜索
			if(StrUtil.isNotEmpty(tablepar.getSearchText())) {//小窗体
				String name = "%"+tablepar.getSearchText()+"%";
				criteria = testExample.createCriteria().andProNameLike(name).andManIdEqualTo(userId);
	        }else {//大搜索
				criteria = testExample.createCriteria().andLikeQuery(applyProject).andManIdEqualTo(userId);
	        }
			//项目类型搜索
		 	if(StrUtil.isNotEmpty(tablepar.getSearchType())) {//小窗体
				criteria.andProTypeChildEqualTo(tablepar.getSearchType()).andManIdEqualTo(userId);}
		 	//项目编号搜索
		 	if(StrUtil.isNotEmpty(tablepar.getSearchNum())) {//小窗体
		 		//模糊搜索
		 		String num = "%"+tablepar.getSearchNum()+"%";
			    criteria.andProNumberLike(num).andManIdEqualTo(userId);}
		 	//学科分类搜索
		    if(StrUtil.isNotEmpty(tablepar.getSearchSub())) {//小窗体
			    criteria.andProSubjectEqualTo(tablepar.getSearchSub()).andManIdEqualTo(userId);}
		    //申报单位搜索
		     if(StrUtil.isNotEmpty(tablepar.getSearchIns())) {//小窗体
				 String ins = "%"+tablepar.getSearchIns()+"%";
			    criteria.andProDeptLike(ins).andManIdEqualTo(userId);}
		    //负责人搜索
		    if(StrUtil.isNotEmpty(tablepar.getSearchMan())) {//小窗体
				String man = "%"+tablepar.getSearchMan()+"%";
			    criteria.andManNameLike(man).andManIdEqualTo(userId);}
			//表格排序
			//if(StrUtil.isNotEmpty(tablepar.getOrderByColumn())) {
	        //	testExample.setOrderByClause(StringUtils.toUnderScoreCase(tablepar.getOrderByColumn()) +" "+tablepar.getIsAsc());
	        //}else{
	        //	testExample.setOrderByClause("id ASC");
	        //}
	        PageHelper.startPage(tablepar.getPage(), tablepar.getLimit());
	        List<ApplyProject> list= applyProjectMapper.selectByExample(testExample);
	        PageInfo<ApplyProject> pageInfo = new PageInfo<ApplyProject>(list);
	        return  pageInfo;
	 }

	/**
	 * 单位立项审核分页查询
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	public PageInfo<ApplyProject> listAudit(Tablepar tablepar,ApplyProject applyProject){
		ApplyProjectExample testExample=new ApplyProjectExample();
		ApplyProjectExample.Criteria criteria = null;
		//获取当前用户id
		String userId = ShiroUtils.getUser().getId();
		//通过当前用户id查找所在单位名称
		String deptName = tsysUserMapper.selectByPrimaryKey(userId).getDeptName();
		//单位审核状态
		List<Integer> stateList = new ArrayList<>();
		stateList.add(Examine.NEED_EXAMINE.code);
		stateList.add(Examine.PASSED.code);
		stateList.add(Examine.BANNED.code);
		
		//项目名称搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchText())) {//小窗体
			String name = "%"+tablepar.getSearchText()+"%";
			criteria = testExample.createCriteria().andProNameLike(name).andProDeptEqualTo(deptName).andDeptPassIn(stateList);
		}else {//大搜索
			criteria = testExample.createCriteria().andProDeptEqualTo(deptName).andDeptPassIn(stateList);
		}
		//项目类型搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchType())) {//小窗体
			criteria.andProTypeChildEqualTo(tablepar.getSearchType()).andProDeptEqualTo(deptName).andDeptPassIn(stateList);}
		//项目编号搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchNum())) {//小窗体
			//模糊搜索
			String num = "%"+tablepar.getSearchNum()+"%";
			criteria.andProNumberLike(num).andProDeptEqualTo(deptName).andDeptPassIn(stateList);}
		//学科分类搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchSub())) {//小窗体
			criteria.andProTypeChildEqualTo(tablepar.getSearchSub()).andProDeptEqualTo(deptName).andDeptPassIn(stateList);}
		//申报单位搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchIns())) {//小窗体
			String ins = "%"+tablepar.getSearchIns()+"%";
			criteria.andProDeptLike(ins).andProDeptEqualTo(deptName).andDeptPassIn(stateList);}
		//负责人搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchMan())) {//小窗体
			String man = "%"+tablepar.getSearchMan()+"%";
			criteria.andManNameLike(man).andProDeptEqualTo(deptName).andDeptPassIn(stateList);}
		//表格排序
		//if(StrUtil.isNotEmpty(tablepar.getOrderByColumn())) {
		//	testExample.setOrderByClause(StringUtils.toUnderScoreCase(tablepar.getOrderByColumn()) +" "+tablepar.getIsAsc());
		//}else{
		//	testExample.setOrderByClause("id ASC");
		//}
		PageHelper.startPage(tablepar.getPage(), tablepar.getLimit());
		List<ApplyProject> list= applyProjectMapper.selectByExample(testExample);
		PageInfo<ApplyProject> pageInfo = new PageInfo<ApplyProject>(list);
		return  pageInfo;
	}

	/**
	 * 社科联立项审核分页查询
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	public PageInfo<ApplyProject> listAuditSKL(Tablepar tablepar,ApplyProject applyProject){
		ApplyProjectExample testExample=new ApplyProjectExample();
		ApplyProjectExample.Criteria criteria = null;
		//社科联审核状态：待审核、不通过、通过、专家审核中、专家审核完成状态
		List<Integer> inList = new ArrayList<>();
		inList.add(Examine.NEED_EXAMINE.code);
		inList.add(Examine.PASSED.code);
		inList.add(Examine.BANNED.code);
		inList.add(Examine.EXPECT_DOING.code);
		inList.add(Examine.EXPECT_DONE.code);

		//项目名称搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchText())) {//小窗体
			String name = "%"+tablepar.getSearchText()+"%";
			criteria = testExample.createCriteria().andProNameLike(name).andSklPassIn(inList);
		}else {//大搜索
			criteria = testExample.createCriteria().andLikeQuery(applyProject).andSklPassIn(inList);
		}
		//项目类型搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchType())) {//小窗体
			criteria.andProTypeChildEqualTo(tablepar.getSearchType()).andSklPassIn(inList);}
		//项目编号搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchNum())) {//小窗体
			//模糊搜索
			String num = "%"+tablepar.getSearchNum()+"%";
			criteria.andProNumberLike(num).andSklPassIn(inList);}
		//学科分类搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchSub())) {//小窗体
			criteria.andProSubjectEqualTo(tablepar.getSearchSub()).andSklPassIn(inList);}
		//申报单位搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchIns())) {//小窗体
			String ins = "%"+tablepar.getSearchIns()+"%";
			criteria.andProDeptLike(ins).andSklPassIn(inList);}
		//负责人搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchMan())) {//小窗体
			String man = "%"+tablepar.getSearchMan()+"%";
			criteria.andManNameLike(man).andSklPassIn(inList);}
		//表格排序
		//if(StrUtil.isNotEmpty(tablepar.getOrderByColumn())) {
		//	testExample.setOrderByClause(StringUtils.toUnderScoreCase(tablepar.getOrderByColumn()) +" "+tablepar.getIsAsc());
		//}else{
		//	testExample.setOrderByClause("id ASC");
		//}
		PageHelper.startPage(tablepar.getPage(), tablepar.getLimit());
		List<ApplyProject> list= applyProjectMapper.selectByExample(testExample);
		PageInfo<ApplyProject> pageInfo = new PageInfo<ApplyProject>(list);
		return  pageInfo;
	}

	/**
	 * 专家立项审核评分分页查询
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	public PageInfo<ApplyProject> listApplyExpert(Tablepar tablepar,ApplyProject applyProject){
		ApplyProjectExample testExample=new ApplyProjectExample();
		ApplyProjectExample.Criteria criteria = null;
		//项目中专家审核字段为待审核或完成审核
		List<Integer> inList = new ArrayList<Integer>();
		inList.add(Examine.NEED_EXAMINE.code);
		inList.add(Examine.PASSED.code);
		//获取当前专家用户id
		String userId = ShiroUtils.getUserId();
		ExperprojectExample epExample = new ExperprojectExample();
		//与专家对应的项目id
		epExample.createCriteria().andExpertIdEqualTo(userId).andOther1EqualTo(ExpertSelect.EXPERT_APPLY.code);
		List<Experproject> listPro = new ArrayList<>();
		listPro = experprojectMapper.selectByExample(epExample);
		List<String> proIdList = new ArrayList<>();
		for (Experproject ep:listPro) {
			proIdList.add(ep.getProId());
		}
		//为List赋初值，避免size=0报错
		proIdList.add("0");


		//项目名称搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchText())) {//小窗体
			String name = "%"+tablepar.getSearchText()+"%";
			criteria = testExample.createCriteria().andProNameLike(name).andExpertPassIn(inList).andIdIn(proIdList);
		}else {//大搜索
			criteria = testExample.createCriteria().andIdIn(proIdList).andExpertPassIn(inList);
		}
		//项目类型搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchType())) {//小窗体
			criteria = testExample.createCriteria().andProTypeEqualTo(tablepar.getSearchType()).andExpertPassIn(inList).andIdIn(proIdList);}
		//项目编号搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchNum())) {//小窗体
			//模糊搜索
			String num = "%"+tablepar.getSearchNum()+"%";
			criteria = testExample.createCriteria().andProNumberLike(num).andExpertPassIn(inList).andIdIn(proIdList);}
		//学科分类搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchSub())) {//小窗体
			criteria = testExample.createCriteria().andProSubjectLike(tablepar.getSearchSub()).andExpertPassIn(inList).andIdIn(proIdList);}
		//申报单位搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchIns())) {//小窗体
			String ins = "%"+tablepar.getSearchIns()+"%";
			criteria = testExample.createCriteria().andProDeptLike(ins).andExpertPassIn(inList).andIdIn(proIdList);}
		//负责人搜索
		if(StrUtil.isNotEmpty(tablepar.getSearchMan())) {//小窗体
			String man = "%"+tablepar.getSearchMan()+"%";
			criteria = testExample.createCriteria().andManNameLike(man).andExpertPassIn(inList).andIdIn(proIdList);}
		//表格排序
		//if(StrUtil.isNotEmpty(tablepar.getOrderByColumn())) {
		//	testExample.setOrderByClause(StringUtils.toUnderScoreCase(tablepar.getOrderByColumn()) +" "+tablepar.getIsAsc());
		//}else{
		//	testExample.setOrderByClause("id ASC");
		//}
		PageHelper.startPage(tablepar.getPage(), tablepar.getLimit());
		List<ApplyProject> list= applyProjectMapper.selectByExample(testExample);
		PageInfo<ApplyProject> pageInfo = new PageInfo<ApplyProject>(list);
		return  pageInfo;
	}

	@Override
	public int deleteByPrimaryKey(String ids) {
				
			List<String> lista=ConvertUtil.toListStrArray(ids);
			ApplyProjectExample example=new ApplyProjectExample();
			example.createCriteria().andIdIn(lista);
			return applyProjectMapper.deleteByExample(example);
			
				
	}

	//测试重置数据状态
	public int resetState(String ids) {

		List<String> lista=ConvertUtil.toListStrArray(ids);
		ApplyProjectExample example=new ApplyProjectExample();
		example.createCriteria().andIdIn(lista);
		List<ApplyProject> applyProjectList = new ArrayList<>();
		applyProjectList = applyProjectMapper.selectByExample(example);
		int n = 0;
		for (ApplyProject list:applyProjectList) {
			list.setSklPass(null);
			list.setDeptPass(0);
			list.setProState(0);
			applyProjectMapper.updateByPrimaryKeySelective(list);
			n++;
		}
		return n;
	}
	
	
	@Override
	public ApplyProject selectByPrimaryKey(String id) {
				
			return applyProjectMapper.selectByPrimaryKey(id);
				
	}

	/**
	 * 单位审核
	 * @param record
	 * @return
	 */
	public int updateByPrimaryKeySelectiveDanWei(ApplyProject record) {
		//添加更新时间
		record.setDeptUpdateTime(new Date());
		return applyProjectMapper.updateByPrimaryKeySelective(record);
	}

	/**
	 * 修改
	 * @param record
	 * @return
	 */
	@Override
	public int updateByPrimaryKeySelective(ApplyProject record) {
		//添加时间
		record.setSklUpdateTime(new Date());
		return applyProjectMapper.updateByPrimaryKeySelective(record);
	}

	/**
	 * 修改提交
	 * @param record
	 * @return
	 */
	public int updateByPrimaryKeySelectiveSubmmit(ApplyProject record) {
		//添加时间
		record.setManUpdateTime(new Date());
		//单位审核状态为待审核
		record.setDeptPass(Examine.NEED_EXAMINE.code);
		//项目状态为待审核
		record.setProState(Examine.NEED_EXAMINE.code);

		return applyProjectMapper.updateByPrimaryKeySelective(record);
	}

	/**
	 * 修改保存
	 * @param record
	 * @return
	 */
	public int updateByPrimaryKeySelectiveSave(ApplyProject record) {
		//添加时间
		record.setManUpdateTime(new Date());
		return applyProjectMapper.updateByPrimaryKeySelective(record);
	}


	/**
	 * 添加
	 */
	@Override
	public int insertSelective(ApplyProject record) {

		return applyProjectMapper.insertSelective(record);
	}

	/**
	 * 添加提交
	 */
	public int insertSelectiveAdd(ApplyProject record,String id) {

		//添加id
		record.setId(id);
		//给项目添加待审核状态
		record.setProState(Examine.NEED_EXAMINE.code);
		//将当前用户添加为负责人Id
		record.setManId(ShiroUtils.getUserId());
		//添加填表时间
		record.setManUpdateTime(new Date());
		//判断用户是否为群众或单位申报人员
		TSysRoleUserExample tSysRoleUserExample = new TSysRoleUserExample();
		tSysRoleUserExample.createCriteria().andSysUserIdEqualTo(ShiroUtils.getUserId());
		List<TSysRoleUser> tSysRoleUserList = tSysRoleUserMapper.selectByExample(tSysRoleUserExample);
		for (TSysRoleUser ru:tSysRoleUserList) {
			//用户为单位申报人员
			if(ru.getSysRoleId().equals("620402627791949824")){
				//单位审核为待审核
				record.setDeptPass(Examine.NEED_EXAMINE.code);
				//更新项目编号
				//获取当前用户Id
				String userId = ShiroUtils.getUserId();
				TsysUser tsysUser = sysUserService.selectByPrimaryKey(userId);
				//获取单位
				String deptName = tsysUser.getDeptName();
				//获取单位管理模块信息
				SysPositionExample testExample=new SysPositionExample();
				testExample.createCriteria().andDeptNameEqualTo(deptName);
				List<SysPosition> sysPositionList = new ArrayList<>();
				sysPositionList = sysPositionService.selectByExample(testExample);
				SysPosition sysPosition = sysPositionList.get(0);
				//查找该单位已立项的项目数
				ApplyProjectExample applyProjectExample = new ApplyProjectExample();
				applyProjectExample.createCriteria().andProDeptEqualTo(deptName).andProStateNotEqualTo(Examine.NEED_SUBMIT.code);
				List<ApplyProject> applyProjectList = applyProjectService.selectByExample(applyProjectExample);
				int applyProjectNum = applyProjectList.size();
				//获取单位管理模块定义的立项的开始号码
				String applyNum = sysPosition.getApplyNumber();
				String[] applyNums = applyNum.split("-");
				//项目编号
				int applyStartNum =	Integer.parseInt(applyNums[0]);
				applyStartNum += applyProjectNum;
				record.setProNumber(String.valueOf(applyStartNum));
			}
			//群众
			else {
				//单位审核默认通过
				record.setDeptPass(Examine.PASSED.code);
				//更新项目编号
				//获取当前用户Id
				String userId = ShiroUtils.getUserId();
				TsysUser tsysUser = sysUserService.selectByPrimaryKey(userId);
				//获取单位
				String deptName = tsysUser.getDeptName();
				//获取单位管理模块信息
				SysPositionExample testExample=new SysPositionExample();
				testExample.createCriteria().andDeptNameEqualTo(deptName);
				List<SysPosition> sysPositionList = new ArrayList<>();
				sysPositionList = sysPositionService.selectByExample(testExample);
				SysPosition sysPosition = sysPositionList.get(0);
				//查找该所有群众立项的项目数
				ApplyProjectExample applyProjectExample = new ApplyProjectExample();
				applyProjectExample.createCriteria().andProDeptIsNull().andProStateNotEqualTo(Examine.NEED_SUBMIT.code);
				List<ApplyProject> applyProjectList = applyProjectService.selectByExample(applyProjectExample);
				int applyProjectNum = applyProjectList.size();
				//获取群众的立项的开始号码
				String applyNum = sysPosition.getApplyNumber();
				String[] applyNums = applyNum.split("-");
				//项目编号
				int applyStartNum =	Integer.parseInt(applyNums[0]);
				applyStartNum += applyProjectNum;
				record.setProNumber(String.valueOf(applyStartNum));
			}
		}
		return applyProjectMapper.insertSelective(record);
	}

	/**
	 * 添加保存
	 */
	public int insertSelectiveAddSave(ApplyProject record,String id) {

		//添加id
		record.setId(id);
		//给项目添加待提交状态
		record.setProState(Examine.NEED_SUBMIT.code);
		//将当前用户添加为负责人Id
		record.setManId(ShiroUtils.getUserId());
		//添加填表时间
		record.setManUpdateTime(new Date());
		//判断用户是否为群众或单位申报人员
		TSysRoleUserExample tSysRoleUserExample = new TSysRoleUserExample();
		tSysRoleUserExample.createCriteria().andSysUserIdEqualTo(ShiroUtils.getUserId());
		List<TSysRoleUser> tSysRoleUserList = tSysRoleUserMapper.selectByExample(tSysRoleUserExample);
		for (TSysRoleUser ru:tSysRoleUserList) {
			//用户为单位申报人员
			if(ru.getSysRoleId().equals("620402627791949824")){
				//更新项目编号
				//获取当前用户Id
				String userId = ShiroUtils.getUserId();
				TsysUser tsysUser = sysUserService.selectByPrimaryKey(userId);
				//获取单位
				String deptName = tsysUser.getDeptName();
				//获取单位管理模块信息
				SysPositionExample testExample=new SysPositionExample();
				testExample.createCriteria().andDeptNameEqualTo(deptName);
				List<SysPosition> sysPositionList = new ArrayList<>();
				sysPositionList = sysPositionService.selectByExample(testExample);
				SysPosition sysPosition = sysPositionList.get(0);
				//查找该单位已立项的项目数
				ApplyProjectExample applyProjectExample = new ApplyProjectExample();
				applyProjectExample.createCriteria().andProDeptEqualTo(deptName).andProStateNotEqualTo(Examine.NEED_SUBMIT.code);
				List<ApplyProject> applyProjectList = applyProjectService.selectByExample(applyProjectExample);
				int applyProjectNum = applyProjectList.size();
				//获取单位管理模块定义的立项的开始号码
				String applyNum = sysPosition.getApplyNumber();
				String[] applyNums = applyNum.split("-");
				//项目编号
				int applyStartNum =	Integer.parseInt(applyNums[0]);
				applyStartNum += applyProjectNum;
				record.setProNumber(String.valueOf(applyStartNum));
			}
			//群众
			else {
				//更新项目编号
				//获取当前用户Id
				String userId = ShiroUtils.getUserId();
				TsysUser tsysUser = sysUserService.selectByPrimaryKey(userId);
				//获取单位
				String deptName = tsysUser.getDeptName();
				//获取单位管理模块信息
				SysPositionExample testExample=new SysPositionExample();
				testExample.createCriteria().andDeptNameEqualTo(deptName);
				List<SysPosition> sysPositionList = new ArrayList<>();
				sysPositionList = sysPositionService.selectByExample(testExample);
				SysPosition sysPosition = sysPositionList.get(0);
				//查找该所有群众立项的项目数
				ApplyProjectExample applyProjectExample = new ApplyProjectExample();
				applyProjectExample.createCriteria().andProDeptIsNull().andProStateNotEqualTo(Examine.NEED_SUBMIT.code);
				List<ApplyProject> applyProjectList = applyProjectService.selectByExample(applyProjectExample);
				int applyProjectNum = applyProjectList.size();
				//获取群众的立项的开始号码
				String applyNum = sysPosition.getApplyNumber();
				String[] applyNums = applyNum.split("-");
				//项目编号
				int applyStartNum =	Integer.parseInt(applyNums[0]);
				applyStartNum += applyProjectNum;
				record.setProNumber(String.valueOf(applyStartNum));
			}
		}
		return applyProjectMapper.insertSelective(record);
	}
	
	
	@Override
	public int updateByExampleSelective(ApplyProject record, ApplyProjectExample example) {
		
		return applyProjectMapper.updateByExampleSelective(record, example);
	}

	
	@Override
	public int updateByExample(ApplyProject record, ApplyProjectExample example) {
		
		return applyProjectMapper.updateByExample(record, example);
	}

	@Override
	public List<ApplyProject> selectByExample(ApplyProjectExample example) {
		
		return applyProjectMapper.selectByExample(example);
	}

	
	@Override
	public long countByExample(ApplyProjectExample example) {
		
		return applyProjectMapper.countByExample(example);
	}

	
	@Override
	public int deleteByExample(ApplyProjectExample example) {
		
		return applyProjectMapper.deleteByExample(example);
	}
	
	/**
	 * 修改权限状态展示或者不展示
	 * @param applyProject
	 * @return
	 */
	public int updateVisible(ApplyProject applyProject) {
		return applyProjectMapper.updateByPrimaryKeySelective(applyProject);
	}


}
